using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Community.SharePoint.Utilities.Branding
{
    public partial class Options : Form
    {
        private LocalisationList m_localisationList = new LocalisationList();
        private string m_userPath = string.Empty;

        public string Lcid
        {
            get 
            {
                return BrandingHelper.Lcid;
            }
            set 
            {
                BrandingHelper.Lcid = value;
            }
        }

        public Options()
        {
            InitializeComponent();
            m_localisationList.LoadAvailableLanguages();
            this.lcidComboBox.DataSource = m_localisationList.items;
            this.lcidComboBox.DisplayMember = "Language";
            labelCurrentLcid.Text = "Current Language Lcid: " + Lcid;
        }

        private void applyButton_Click(object sender, EventArgs e)
        {
            Localisation l = (Localisation)this.lcidComboBox.SelectedValue;
            Lcid = l.Lcid;
            BrandingHelper.SaveSettings();
            labelCurrentLcid.Text = "Current Language Lcid: " + Lcid;
            this.Close();
        }

        private void cancelButton_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void lcidComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            labelLCID.Text = "LCID: " + ((Localisation)lcidComboBox.SelectedItem).Lcid;
        }
    }
}